<%- include header %>
<!-- 主题内容start -->
<form class="form-horizontal" action="" method="post">
    <fieldset>
        <legend>咖啡厅添加</legend>
        <div class="control-group">
            <label class="control-label">名称</label>
            <div class="controls">
                <input type="text" class="input-xlarge"  name="name">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">地址</label>
            <div class="controls">
                <select id="province" name="province" style="width: 100px" onchange="loadCity(this);">
                    <option value="">请选择</option>
                    <% datas.forEach(function(data,index){%>
                        <option value="<%- data._id %>"><%- data.name %></option>
                    <% }) %>
                </select>
                <select id="city" name="city" style="width: 100px" onchange="loadArea(this)">
                    <option value="">请选择</option>
                </select>
                <select id="area" name="area" style="width: 100px">
                    <option value="">请选择</option>
                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="username">详细地址</label>
            <div class="controls">
                <input type="text" class="input-xlarge"  name="addr">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="password">简介</label>
            <div class="controls">
                <textarea rows="10" style="width: 540px" id="k1" name="intro"></textarea>
            </div>
        </div>

        <div class="form-actions">
            <button type="submit" class="btn btn-primary">提交</button>
        </div>
    </fieldset>
</form>
<!-- 主题内容end -->
<%- include footer %>
<script>
    function loadCity(obj){
        $.ajax({
            type: "get",
            url: "/manager/loadCity?pid="+obj.value,
            success: function(result){
                $("#city").html(result);
            }
        });
    }
    function loadArea(obj){
        $.ajax({
            type: "get",
            url: "/manager/loadArea?cid="+obj.value,
            success: function(result){
                $("#area").html(result);
            }
        });
    }
</script>